<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .parent{
    width:500px;
    height:400px;
    border:1px solid red;
    margin:0 auto;
    /*
    CSS布局方式：浮动 定位 弹性盒/伸缩盒
    */
    /*
    给父类元素设置display为flex 父元素成为弹性盒
    */
    display:flex;
    /*flex-direction: row;
    flex-wrap:wrap;
    justify-content: center;
    align-items: center;*/
    }
    .child{
        /*将父类容器空间分为3份*/
    flex:1;
    width:100px;
    height:60px;
    color:white;
    }
    .second{
           flex:2
    }
</style>
<body>
    <div class="parent">
    <div class="child" style="background-color: red;">弹性元素1</div>
    <div class="child second" style="background-color: green;">弹性元素2</div>
    <div class="child" style="background-color: blue">弹性元素3</div>
    <!--<div class="child" style="background-color: red;">弹性元素1</div>
    <div class="child" style="background-color: green;">弹性元素2</div>
    <div class="child" style="background-color: blue">弹性元素3</div>-->
    </div>


</body>
</html>